home *** CD-ROM | disk | FTP | other *** search
-
- // Copyright (C) 2002 by Luigi Pino. All Rights Reserved.
-
- /***************************************************************************/
-
- #include "../library/neurosis.h"
- #include "draw.h"
- #include "file_io.h"
- #include "hiscore.h"
- #include "initialize.h"
- #include "main.h"
- #include "menu_misc.h"
- #include "paddle.h"
- #include "sphere.h"
- #include "update.h"
-
- /***************************************************************************/
-
- float blink = 0.0f;
- float menu_rotate = 0.0f;
- int old_screen_width;
-
- extern High_Score_Struct high_score_sphere;
- extern High_Score_Struct high_score_time;
- extern Light_Values_Struct light_values;
- extern Main_Menu_Class menu;
- extern Paddle_Struct paddle_object[];
- extern Sub_Menu_Class menu_main;
- extern Sub_Menu_Class menu_options;
- extern Sub_Menu_Class menu_control;
- extern Sub_Menu_Class menu_high_scores;
- extern Sub_Menu_Class game_paused;
- extern Sub_Menu_Class game_scores;
- extern Timing_Class timing;
- extern Values_Struct values;
- extern Window_Class window;
-
- extern bool connected[];
- extern char high_score_name[];
-
- /***************************************************************************/
-
- void Initialize_Menu()
-
- {
- menu.Set_Current(&menu_main);
-
- // Main options
- menu_main.Rename_Option(0, "GAME OPTIONS\0");
- menu_main.Add_Option("CONTROL OPTIONS\0");
- menu_main.Add_Option("PLAY TIMED GAME\0");
- menu_main.Add_Option("PLAY COUNTDOWN GAME\0");
- menu_main.Add_Option("PLAY HIGH SCORE GAME\0");
- menu_main.Add_Option("SHOW HIGH SCORES\0");
- menu_main.Add_Option("QUIT\0");
-
- // Game options
- menu_options.Rename_Option(0, "SOUND:\0");
- menu_options.Add_Option("RESOLUTION:\0");
- menu_options.Add_Option("TIMED:\0");
- menu_options.Add_Option("COUNTDOWN:\0");
- menu_options.Add_Option("RETURN\0");
-
- // Sound choices
- menu_options.Rename_Choice(0, 0, "ON\0");
- menu_options.Add_Choice(0, "OFF\0");
-
- // Resolution choices
- menu_options.Rename_Choice(1, 0, "640 X 480\0");
- menu_options.Add_Choice(1, "800 X 600\0");
- menu_options.Add_Choice(1, "1024 X 768\0");
-
- // Timed choices
- menu_options.Rename_Choice(2, 0, "5 MINUTES\0");
- menu_options.Add_Choice(2, "10 MINUTES\0");
- menu_options.Add_Choice(2, "15 MINUTES\0");
-
- // Countdown choices
- menu_options.Rename_Choice(3, 0, "300 POINTS\0");
- menu_options.Add_Choice(3, "600 POINTS\0");
- menu_options.Add_Choice(3, "900 POINTS\0");
-
- // Control options
- menu_control.Rename_Option(0, "TOP PLAYER:\0");
- menu_control.Add_Option("BOTTOM PLAYER:\0");
- menu_control.Add_Option("LEFT PLAYER:\0");
- menu_control.Add_Option("RIGHT PLAYER:\0");
- menu_control.Add_Option("HIGH SCORE:\0");
- menu_control.Add_Option("RETURN\0");
-
- // Top player
- menu_control.Rename_Choice(0, 0, "KEYBOARD 1\0");
- menu_control.Add_Choice(0, "KEYBOARD 2\0");
- menu_control.Add_Choice(0, "JOYSTICK 1\0");
- menu_control.Add_Choice(0, "JOYSTICK 2\0");
- menu_control.Add_Choice(0, "JOYSTICK 3\0");
- menu_control.Add_Choice(0, "JOYSTICK 4\0");
- menu_control.Add_Choice(0, "COMPUTER\0");
- menu_control.Add_Choice(0, "NONE\0");
-
- // Left player
- menu_control.Rename_Choice(1, 0, "KEYBOARD 1\0");
- menu_control.Add_Choice(1, "KEYBOARD 2\0");
- menu_control.Add_Choice(1, "JOYSTICK 1\0");
- menu_control.Add_Choice(1, "JOYSTICK 2\0");
- menu_control.Add_Choice(1, "JOYSTICK 3\0");
- menu_control.Add_Choice(1, "JOYSTICK 4\0");
- menu_control.Add_Choice(1, "COMPUTER\0");
- menu_control.Add_Choice(1, "NONE\0");
-
- // Right player
- menu_control.Rename_Choice(2, 0, "KEYBOARD 1\0");
- menu_control.Add_Choice(2, "KEYBOARD 2\0");
- menu_control.Add_Choice(2, "JOYSTICK 1\0");
- menu_control.Add_Choice(2, "JOYSTICK 2\0");
- menu_control.Add_Choice(2, "JOYSTICK 3\0");
- menu_control.Add_Choice(2, "JOYSTICK 4\0");
- menu_control.Add_Choice(2, "COMPUTER\0");
- menu_control.Add_Choice(2, "NONE\0");
-
- // Bottom player
- menu_control.Rename_Choice(3, 0, "KEYBOARD 1\0");
- menu_control.Add_Choice(3, "KEYBOARD 2\0");
- menu_control.Add_Choice(3, "JOYSTICK 1\0");
- menu_control.Add_Choice(3, "JOYSTICK 2\0");
- menu_control.Add_Choice(3, "JOYSTICK 3\0");
- menu_control.Add_Choice(3, "JOYSTICK 4\0");
- menu_control.Add_Choice(3, "COMPUTER\0");
- menu_control.Add_Choice(3, "NONE\0");
-
- // High score player
- menu_control.Rename_Choice(4, 0, "KEYBOARD 1\0");
- menu_control.Add_Choice(4, "KEYBOARD 2\0");
- menu_control.Add_Choice(4, "JOYSTICK 1\0");
- menu_control.Add_Choice(4, "JOYSTICK 2\0");
- menu_control.Add_Choice(4, "JOYSTICK 3\0");
- menu_control.Add_Choice(4, "JOYSTICK 4\0");
-
- for (int x1=Joystick_1;x1<=Joystick_4;x1=x1+1)
- {
- if (connected[x1] == true)
- {
- menu_control.Set_Access_Choice(0, x1, true);
- menu_control.Set_Access_Choice(1, x1, true);
- menu_control.Set_Access_Choice(2, x1, true);
- menu_control.Set_Access_Choice(3, x1, true);
- menu_control.Set_Access_Choice(4, x1, true);
- }
- else
- {
- menu_control.Set_Access_Choice(0, x1, false);
- menu_control.Set_Access_Choice(1, x1, false);
- menu_control.Set_Access_Choice(2, x1, false);
- menu_control.Set_Access_Choice(3, x1, false);
- menu_control.Set_Access_Choice(4, x1, false);
- }
- }
-
- // Pause menu
- game_paused.Rename_Option(0, "RETURN TO GAME\0");
- game_paused.Add_Option("QUIT TO MAIN MENU\0");
- }
-
- /***************************************************************************/
-
- void Show_Person()
-
- {
- float3 image_base = {320.0f, -240.0f, 0.0f};
- float3 point_up_left = {0.0f, 0.0f, 0.0f};
- float3 point_up_right = {640.0f, 0.0f, 0.0f};
- float3 point_down_right = {640.0f, -480.0f, 0.0f};
- float3 point_down_left = {0.0f, -480.0f, 0.0f};
-
- Rotate_z(&image_base, &point_up_left, menu_rotate);
- Rotate_z(&image_base, &point_up_right, menu_rotate);
- Rotate_z(&image_base, &point_down_right, menu_rotate);
- Rotate_z(&image_base, &point_down_left, menu_rotate);
-
- glEnable(GL_BLEND);
- glBlendFunc(GL_DST_COLOR, GL_ZERO);
-
- Quad_Texture(t_menu_mask_2, point_up_left.x, point_up_left.y, 0.0f, point_up_right.x, point_up_right.y, 0.0f,
- point_down_right.x, point_down_right.y, 0.0f, point_down_left.x, point_down_left.y, 0.0f,
- 0.0f, 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f);
-
- glBlendFunc(GL_ONE, GL_ONE);
-
- Quad_Texture(t_menu_2, point_up_left.x, point_up_left.y, 0.0f, point_up_right.x, point_up_right.y, 0.0f,
- point_down_right.x, point_down_right.y, 0.0f, point_down_left.x, point_down_left.y, 0.0f,
- 0.0f, 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f);
-
- glEnable(GL_BLEND);
- glBlendFunc(GL_DST_COLOR, GL_ZERO);
-
- Quad_Texture(t_menu_mask_1, 200.0f, -50.0f, 0.0f, 470.0f, -50.0f, 0.0f, 470.0f, -240.0f, 0.0f, 200.0f, -240.0f, 0.0f,
- 0.0f, 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f);
-
- glBlendFunc(GL_ONE, GL_ONE);
-
- if (blink > 200.0f)
- Quad_Texture(t_menu_1, 200.0f, -50.0f, 0.0f, 470.0f, -50.0f, 0.0f, 470.0f, -240.0f, 0.0f, 200.0f, -240.0f, 0.0f,
- 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f);
- else
- Quad_Texture(t_menu_1, 200.0f, -50.0f, 0.0f, 470.0f, -50.0f, 0.0f, 470.0f, -240.0f, 0.0f, 200.0f, -240.0f, 0.0f,
- 0.0f, 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f);
-
- glDisable(GL_BLEND);
-
- menu_rotate = menu_rotate + (100.0f * timing.Get_Scale());
- blink = blink + (100.0f * timing.Get_Scale());
-
- if (blink > 220.0f)
- blink = 0.0f;
- }
-
- /***************************************************************************/
-
- void Show_Menu(Sub_Menu_Class *menu, bool show_stuff, bool show_players)
-
- {
- float current_y = 170.0f;
- int x1;
-
- Show_Person();
-
- // Print out menu items
- for (x1=0;x1<menu->Option_Size();x1=x1+1)
- {
- if (x1 == menu->Get_Current_Option())
- {
- window.Font_Char(menu->Get_Option_Info(x1), -280.0f, current_y, 20.0f, R_4, G_4, B_4);
- window.Font_Char(menu->Get_Choice_Info(x1), -90.0f, current_y, 20.0f, R_4, G_4, B_4);
- }
- else
- {
- window.Font_Char(menu->Get_Option_Info(x1), -280.0f, current_y, 20.0f, R_3, G_3, B_3);
- window.Font_Char(menu->Get_Choice_Info(x1), -90.0f, current_y, 20.0f, R_3, G_3, B_3);
- }
-
- current_y = current_y - 40.0f;
- }
-
- if (show_players == true)
- {
- window.Font_Char("NUMBER OF PLAYERS:", -220.0f, 220.0f, 10.0f, R_3, G_3, B_3);
- window.Font_Int(values.player_number, -100.0f, 220.0f, 10.0f, R_3, G_3, B_3);
- }
-
- if (show_stuff == true)
- {
- if (values.game_type == Timed)
- {
- if (values.seconds_left > 0.0f)
- {
- window.Font_Char("TOP PLAYER SCORE: LEFT PLAYER SCORE: TIME LEFT-", -250.0f, 210.0f, 10.0f, R_3, G_3, B_3);
- window.Font_Char("RIGHT PLAYER SCORE: BOTTOM PLAYER SCORE:", -250.0f, 190.0f, 10.0f, R_3, G_3, B_3);
- window.Font_Time(false, true, true, false, values.seconds_left, 185.0f, 210.0f, 10.0f, R_3, G_3, B_3);
-
- if (paddle_object[Up].game_over == false)
- window.Font_Int((int)(paddle_object[Up].score), -122.0f, 210.0f, 10.0f, R_3, G_3, B_3);
- else
- window.Font_Char("TOP PLAYER SCORE:", -250.0f, 210.0f, 10.0f, R_2, G_2, B_2);
-
- if (paddle_object[Left].game_over == false)
- window.Font_Int((int)(paddle_object[Left].score), 65.0f, 210.0f, 10.0f, R_3, G_3, B_3);
- else
- window.Font_Char(" LEFT PLAYER SCORE:", -250.0f, 210.0f, 10.0f, R_2, G_2, B_2);
-
- if (paddle_object[Right].game_over == false)
- window.Font_Int((int)(paddle_object[Right].score), -122.0f, 190.0f, 10.0f, R_3, G_3, B_3);
- else
- window.Font_Char("RIGHT PLAYER SCORE:", -250.0f, 190.0f, 10.0f, R_2, G_2, B_2);
-
- if (paddle_object[Down].game_over == false)
- window.Font_Int((int)(paddle_object[Down].score), 65.0f, 190.0f, 10.0f, R_3, G_3, B_3);
- else
- window.Font_Char(" BOTTOM PLAYER SCORE:", -250.0f, 190.0f, 10.0f, R_2, G_2, B_2);
- }
- else
- {
- int count = 0;
- int x1;
-
- for (x1=Up;x1<=Right;x1=x1+1)
- {
- if (paddle_object[x1].game_over == false)
- count = count + 1;
- }
-
- if (count > 1)
- {
- window.Font_Char("TOP PLAYER SCORE: LEFT PLAYER SCORE: LAST GOAL WINS", -250.0f, 210.0f, 10.0f, R_3, G_3, B_3);
- window.Font_Char("RIGHT PLAYER SCORE: BOTTOM PLAYER SCORE:", -250.0f, 190.0f, 10.0f, R_3, G_3, B_3);
- }
- }
- }
- else if (values.game_type == Countdown)
- {
- window.Font_Char("TOP PLAYER SCORE: LEFT PLAYER SCORE:", -250.0f, 210.0f, 10.0f, R_3, G_3, B_3);
- window.Font_Char("RIGHT PLAYER SCORE: BOTTOM PLAYER SCORE:", -250.0f, 190.0f, 10.0f, R_3, G_3, B_3);
-
- if (paddle_object[Up].game_over == false)
- window.Font_Int((int)(paddle_object[Up].score), -122.0f, 210.0f, 10.0f, R_3, G_3, B_3);
- else
- window.Font_Char("TOP PLAYER SCORE:", -250.0f, 210.0f, 10.0f, R_2, G_2, B_2);
-
- if (paddle_object[Left].game_over == false)
- window.Font_Int((int)(paddle_object[Left].score), 65.0f, 210.0f, 10.0f, R_3, G_3, B_3);
- else
- window.Font_Char(" LEFT PLAYER SCORE:", -250.0f, 210.0f, 10.0f, R_2, G_2, B_2);
-
- if (paddle_object[Right].game_over == false)
- window.Font_Int((int)(paddle_object[Right].score), -122.0f, 190.0f, 10.0f, R_3, G_3, B_3);
- else
- window.Font_Char("RIGHT PLAYER SCORE:", -250.0f, 190.0f, 10.0f, R_2, G_2, B_2);
-
- if (paddle_object[Down].game_over == false)
- window.Font_Int((int)(paddle_object[Down].score), 65.0f, 190.0f, 10.0f, R_3, G_3, B_3);
- else
- window.Font_Char(" BOTTOM PLAYER SCORE:", -250.0f, 190.0f, 10.0f, R_2, G_2, B_2);
- }
- else
- {
- window.Font_Char("SECONDS SINCE LAST GOAL:", -100.0f, 220.0f, 10.0f, R_9, G_9, B_9);
- window.Font_Float(paddle_object[Down].time_lapse, 2, 125.0f, 220.0f, 10.0f, R_9, G_9, B_9);
- window.Font_Char("MOST TIME WITH NO GOAL THIS GAME:", -100.0f, 205.0f, 10.0f, R_9, G_9, B_9);
- window.Font_Float(paddle_object[Down].time_lapse_score, 2, 125.0f, 205.0f, 10.0f, R_9, G_9, B_9);
- }
- }
-
- window.Font_Char("SPHERICAL VENGEANCE", -300.0f, -215.0f, 10.0f, R_4, G_4, B_4);
- window.Font_Char("THE 23RD DIMENSION - LP23.COM", -300.0f, -225.0f, 10.0f, R_4, G_4, B_4);
- }
-
- /***************************************************************************/
-
- void Menu()
-
- {
- TCHAR joystick_name[256];
- int x1;
-
- menu.Update();
-
- if (menu.Get_Current() == &menu_main)
- {
- if (((menu_main.Get_Current_Option() == 6) && (menu.Enter_Pressed() == true)) || (menu.Escape_Pressed() == true))
- {
- // Exit menu
- Save_Config_File();
- values.game_position = Game_Ending;
- values.fade_amount = 0.0f;
- window.keys[VK_ESCAPE] = false;
- window.keys[VK_RETURN] = false;
- window.Load_Texture(t_menu_1, "Data/menu_3.bmp");
- window.Load_Texture(t_menu_2, "Data/menu_4.bmp");
- }
- else if (menu.Enter_Pressed() == true)
- {
- if (menu_main.Get_Current_Option() == 0)
- {
- old_screen_width = menu_options.Get_Current_Choice(1);
- menu.Set_Current(&menu_options);
- }
- else if (menu_main.Get_Current_Option() == 1)
- menu.Set_Current(&menu_control);
- else if (menu_main.Get_Current_Option() == 2)
- {
- values.game_position = Game_Play;
- values.game_type = Timed;
- values.sphere_number = 3;
- Save_Config_File();
- Initialize_Game();
- light_values.distance_current = light_values.distance_destination = 0.0f;
- light_values.rotate_current = light_values.rotate_destination = 0.0f;
- values.seconds_left = 300.0f + (menu_options.Get_Current_Choice(2) * 300.0f);
- }
- else if (menu_main.Get_Current_Option() == 3)
- {
- values.game_position = Game_Play;
- values.game_type = Countdown;
- values.sphere_number = 1;
- Save_Config_File();
- Initialize_Game();
- light_values.distance_current = light_values.distance_destination = 0.0f;
- light_values.rotate_current = light_values.rotate_destination = 0.0f;
- }
- else if (menu_main.Get_Current_Option() == 4)
- {
- values.game_position = Game_Play;
- values.game_type = High_Score;
- values.sphere_number = 4;
- Save_Config_File();
- Initialize_Game();
- light_values.distance_current = light_values.distance_destination = 150.0f;
- light_values.rotate_current = light_values.rotate_destination = 270.0f;
- values.seconds_left = 150.0f;
- }
- else if (menu_main.Get_Current_Option() == 5)
- menu.Set_Current(&menu_high_scores);
- }
- else
- {
- if (menu_main.Get_Current_Option() == 0)
- {
- window.Font_Char("---------------", 20.0f, 200.0f, 10.0f, R_5, G_5, B_5);
- window.Font_Char("SOUND / SCREEN / GAME PLAY OPTIONS.", 20.0f, 185.0f, 10.0f, R_5, G_5, B_5);
- window.Font_Char("---------------", 20.0f, 170.0f, 10.0f, R_5, G_5, B_5);
- }
- else if (menu_main.Get_Current_Option() == 1)
- {
- window.Font_Char("---------------", 20.0f, 200.0f, 10.0f, R_5, G_5, B_5);
- window.Font_Char("CHANGE GAMEPLAY CONTROLS.", 20.0f, 185.0f, 10.0f, R_5, G_5, B_5);
- window.Font_Char("---------------", 20.0f, 170.0f, 10.0f, R_5, G_5, B_5);
- }
- else if (menu_main.Get_Current_Option() == 2)
- {
- window.Font_Char("---------------", 20.0f, 200.0f, 10.0f, R_5, G_5, B_5);
- window.Font_Char("PLAY UNTIL ONLY ONE PLAYER IS LEFT.", 20.0f, 185.0f, 10.0f, R_5, G_5, B_5);
- window.Font_Char("---------------", 20.0f, 170.0f, 10.0f, R_5, G_5, B_5);
- }
- else if (menu_main.Get_Current_Option() == 3)
- {
- window.Font_Char("---------------", 20.0f, 200.0f, 10.0f, R_5, G_5, B_5);
- window.Font_Char("THE PERSON WHO LETS IN THE SPHERE GETS", 20.0f, 185.0f, 10.0f, R_5, G_5, B_5);
- window.Font_Char("THEIR SCORE VALUE COUNTED DOWN UNTIL", 20.0f, 170.0f, 10.0f, R_5, G_5, B_5);
- window.Font_Char("ANOTHER PERSON LETS IN THE SPHERE.", 20.0f, 155.0f, 10.0f, R_5, G_5, B_5);
- window.Font_Char("LAST PERSON LEFT WINS.", 20.0f, 140.0f, 10.0f, R_5, G_5, B_5);
- window.Font_Char("---------------", 20.0f, 125.0f, 10.0f, R_5, G_5, B_5);
- }
- else if (menu_main.Get_Current_Option() == 4)
- {
- window.Font_Char("---------------", 20.0f, 200.0f, 10.0f, R_5, G_5, B_5);
- window.Font_Char("COMPETE WITH OTHER PEOPLE. TRY TO GET", 20.0f, 185.0f, 10.0f, R_5, G_5, B_5);
- window.Font_Char("THE LEAST AMOUNT OF SPHERES IN 2.5 MINUTES.", 20.0f, 170.0f, 10.0f, R_5, G_5, B_5);
- window.Font_Char("ALSO TRY TO GO THE LONGEST AMOUNT OF TIME", 20.0f, 155.0f, 10.0f, R_5, G_5, B_5);
- window.Font_Char("WITHOUT LETTING A SPHERE IN. THEN E-MAIL", 20.0f, 140.0f, 10.0f, R_5, G_5, B_5);
- window.Font_Char("MAIL@LP23.COM", 20.0f, 125.0f, 10.0f, R_4, G_4, B_4);
- window.Font_Char(" AND THE BEST 5 FOR EACH WILL", 20.0f, 125.0f, 10.0f, R_5, G_5, B_5);
- window.Font_Char("BE POSTED. FOR MORE INFO CHECK README.TXT", 20.0f, 110.0f, 10.0f, R_5, G_5, B_5);
- window.Font_Char("---------------", 20.0f, 95.0f, 10.0f, R_5, G_5, B_5);
- }
-
- Show_Menu(&menu_main, false, true);
- }
- }
- else if (menu.Get_Current() == &menu_options)
- {
- if (((menu_options.Get_Current_Option() == 4) && (menu.Enter_Pressed() == true)) || (menu.Escape_Pressed() == true))
- {
- // Exit menu
- Save_Config_File();
- menu.Set_Current(&menu_main);
- menu_options.Set_Current_Option(0);
-
- if (old_screen_width != menu_options.Get_Current_Choice(1))
- {
- if (menu_options.Get_Current_Choice(1) == 0)
- {
- window.screen_height = 480;
- window.screen_width = 640;
- }
- else if (menu_options.Get_Current_Choice(1) == 1)
- {
- window.screen_height = 600;
- window.screen_width = 800;
- }
- else
- {
- window.screen_height = 768;
- window.screen_width = 1024;
- }
-
- window.KillGLWindow();
-
- if (!window.CreateGLWindow("Spherical Vengeance", window.screen_width, window.screen_height, 16, true))
- exit(1);
-
- Initialize_Textures(true);
- }
- }
-
- Show_Menu(&menu_options, false, true);
- }
- else if (menu.Get_Current() == &menu_control)
- {
- float current_y = 150.0f;
-
- if (((menu_control.Get_Current_Option() == 5) && (menu.Enter_Pressed() == true)) || (menu.Escape_Pressed() == true))
- {
- // Exit menu
- Save_Config_File();
- menu.Set_Current(&menu_main);
- menu_control.Set_Current_Option(0);
- }
-
- for (x1=Up;x1<=Compete;x1=x1+1)
- {
- if ((menu_control.Get_Current_Choice(x1) >= Joystick_1) && (menu_control.Get_Current_Choice(x1) <= Joystick_4))
- {
- Get_Joystick_Name(menu_control.Get_Current_Choice(x1) - Joystick_1, joystick_name);
-
- if (joystick_name[0] == 0)
- window.Font_Char("Generic", -80.0f, current_y, 10.0f, R_5, G_5, B_5);
- else
- window.Font_Char(joystick_name, -80.0f, current_y, 10.0f, R_5, G_5, B_5);
- }
- else if (menu_control.Get_Current_Choice(x1) == Keyboard_1)
- window.Font_Char("Arrow keys", -80.0f, current_y, 10.0f, R_5, G_5, B_5);
- else if (menu_control.Get_Current_Choice(x1) == Keyboard_2)
- window.Font_Char("W, A, S, D", -80.0f, current_y, 10.0f, R_5, G_5, B_5);
-
- current_y = current_y - 40.0f;
- }
-
- // Count players
- values.player_number = 0;
-
- for (x1=Up;x1<=Right;x1=x1+1)
- {
- if (menu_control.Get_Current_Choice(x1) != No_User)
- values.player_number = values.player_number + 1;
- }
-
- // If 2 players, make sure none can change to No_User
- if (values.player_number == 2)
- {
- for (x1=Up;x1<=Right;x1=x1+1)
- menu_control.Set_Access_Choice(x1, No_User, false);
- }
- else
- {
- for (x1=Up;x1<=Right;x1=x1+1)
- menu_control.Set_Access_Choice(x1, No_User, true);
- }
-
- Show_Menu(&menu_control, false, true);
- }
- else if (menu.Get_Current() == &menu_high_scores)
- {
- // Clear escape
- menu.Escape_Pressed();
-
- if (menu.Enter_Pressed() == true)
- {
- // Exit menu
- menu.Set_Current(&menu_main);
- }
- else
- {
- Show_High_Scores(false);
- window.Font_Char("PRESS ENTER TO CONTINUE", -180.0f, -150.0f, 20.0f, R_4, G_4, B_4);
- }
- }
- else if (menu.Get_Current() == &game_paused)
- {
- // Clear escape
- menu.Escape_Pressed();
-
- if (menu.Enter_Pressed() == true)
- {
- if (game_paused.Get_Current_Option() == 0)
- {
- // Go back to game
- values.game_position = Game_Play;
- game_paused.Set_Current_Option(0);
- }
- else
- {
- // Exit game
- menu.Set_Current(&menu_main);
- game_paused.Set_Current_Option(0);
- }
- }
-
- Show_Menu(&game_paused, true, false);
- }
- else if (menu.Get_Current() == &game_scores)
- {
- float line_length;
-
- // Clear escape
- menu.Escape_Pressed();
-
- if (values.game_type == Timed)
- {
- float low_score = 10000.0f;
- int low_player = 0;
-
- for (x1=Up;x1<=Right;x1=x1+1)
- {
- if ((paddle_object[x1].game_over == false) && (paddle_object[x1].score < low_score))
- {
- low_score = paddle_object[x1].score;
- low_player = x1;
- }
- }
-
- if (paddle_object[Up].input.user != No_User)
- {
- if (low_player == Up)
- {
- line_length = window.Font_Char("TOP PLAYER WINS WITH ", -280.0f, 105.0f, 15.0f, R_5, G_5, B_5);
- line_length = window.Font_Int((int)(paddle_object[Up].score), line_length, 105.0f, 15.0f, R_5, G_5, B_5);
- window.Font_Char(" AGAINST", line_length, 105.0f, 15.0f, R_5, G_5, B_5);
- }
- else
- {
- line_length = window.Font_Char("TOP PLAYER GOT ", -280.0f, 105.0f, 15.0f, R_8, G_8, B_8);
- line_length = window.Font_Int((int)(paddle_object[Up].score), line_length, 105.0f, 15.0f, R_8, G_8, B_8);
- window.Font_Char(" AGAINST", line_length, 105.0f, 15.0f, R_8, G_8, B_8);
- }
- }
- else
- window.Font_Char("NO TOP PLAYER", -280.0f, 105.0f, 15.0f, R_8, G_8, B_8);
-
- if (paddle_object[Left].input.user != No_User)
- {
- if (low_player == Left)
- {
- line_length = window.Font_Char("LEFT PLAYER WINS WITH ", -280.0f, 80.0f, 15.0f, R_5, G_5, B_5);
- line_length = window.Font_Int((int)(paddle_object[Left].score), line_length, 80.0f, 15.0f, R_5, G_5, B_5);
- window.Font_Char(" AGAINST", line_length, 80.0f, 15.0f, R_5, G_5, B_5);
- }
- else
- {
- line_length = window.Font_Char("LEFT PLAYER GOT ", -280.0f, 80.0f, 15.0f, R_8, G_8, B_8);
- line_length = window.Font_Int((int)(paddle_object[Left].score), line_length, 80.0f, 15.0f, R_8, G_8, B_8);
- window.Font_Char(" AGAINST", line_length, 80.0f, 15.0f, R_8, G_8, B_8);
- }
- }
- else
- window.Font_Char("NO LEFT PLAYER", -280.0f, 80.0f, 15.0f, R_8, G_8, B_8);
-
- if (paddle_object[Right].input.user != No_User)
- {
- if (low_player == Right)
- {
- line_length = window.Font_Char("RIGHT PLAYER WINS WITH ", -280.0f, 55.0f, 15.0f, R_5, G_5, B_5);
- line_length = window.Font_Int((int)(paddle_object[Right].score), line_length, 55.0f, 15.0f, R_5, G_5, B_5);
- window.Font_Char(" AGAINST", line_length, 55.0f, 15.0f, R_5, G_5, B_5);
- }
- else
- {
- line_length = window.Font_Char("RIGHT PLAYER GOT ", -280.0f, 55.0f, 15.0f, R_8, G_8, B_8);
- line_length = window.Font_Int((int)(paddle_object[Right].score), line_length, 55.0f, 15.0f, R_8, G_8, B_8);
- window.Font_Char(" AGAINST", line_length, 55.0f, 15.0f, R_8, G_8, B_8);
- }
- }
- else
- window.Font_Char("NO RIGHT PLAYER", -280.0f, 55.0f, 15.0f, R_8, G_8, B_8);
-
- if (paddle_object[Down].input.user != No_User)
- {
- if (low_player == Down)
- {
- line_length = window.Font_Char("BOTTOM PLAYER WINS WITH ", -280.0f, 30.0f, 15.0f, R_5, G_5, B_5);
- line_length = window.Font_Int((int)(paddle_object[Down].score), line_length, 30.0f, 15.0f, R_5, G_5, B_5);
- window.Font_Char(" AGAINST", line_length, 30.0f, 15.0f, R_5, G_5, B_5);
- }
- else
- {
- line_length = window.Font_Char("BOTTOM PLAYER GOT ", -280.0f, 30.0f, 15.0f, R_8, G_8, B_8);
- line_length = window.Font_Int((int)(paddle_object[Down].score), line_length, 30.0f, 15.0f, R_8, G_8, B_8);
- window.Font_Char(" AGAINST", line_length, 30.0f, 15.0f, R_8, G_8, B_8);
- }
- }
- else
- window.Font_Char("NO BOTTOM PLAYER", -280.0f, 30.0f, 15.0f, R_8, G_8, B_8);
-
- window.Font_Char("PRESS ENTER TO CONTINUE", -200.0f, -15.0f, 20.0f, R_4, G_4, B_4);
- }
- else if (values.game_type == Countdown)
- {
- if (paddle_object[Up].input.user != No_User)
- {
- if (paddle_object[Up].score > 0.0f)
- line_length = window.Font_Char("TOP PLAYER WINS", -280.0f, 105.0f, 15.0f, R_8, G_8, B_8);
- else
- {
- line_length = window.Font_Char("TOP PLAYER LASTED ", -280.0f, 105.0f, 15.0f, R_5, G_5, B_5);
- line_length = window.Font_Int((int)(paddle_object[Up].time_lapse), line_length, 105.0f, 15.0f, R_5, G_5, B_5);
- window.Font_Char(" SECONDS", line_length, 105.0f, 15.0f, R_5, G_5, B_5);
- }
- }
- else
- window.Font_Char("NO TOP PLAYER", -280.0f, 105.0f, 15.0f, R_5, G_5, B_5);
-
- if (paddle_object[Left].input.user != No_User)
- {
- if (paddle_object[Left].score > 0.0f)
- line_length = window.Font_Char("LEFT PLAYER WINS", -280.0f, 80.0f, 15.0f, R_8, G_8, B_8);
- else
- {
- line_length = window.Font_Char("LEFT PLAYER LASTED ", -280.0f, 80.0f, 15.0f, R_5, G_5, B_5);
- line_length = window.Font_Int((int)(paddle_object[Left].time_lapse), line_length, 80.0f, 15.0f, R_5, G_5, B_5);
- window.Font_Char(" SECONDS", line_length, 80.0f, 15.0f, R_5, G_5, B_5);
- }
- }
- else
- window.Font_Char("NO LEFT PLAYER", -280.0f, 80.0f, 15.0f, R_5, G_5, B_5);
-
- if (paddle_object[Right].input.user != No_User)
- {
- if (paddle_object[Right].score > 0.0f)
- line_length = window.Font_Char("RIGHT PLAYER WINS", -280.0f, 55.0f, 15.0f, R_8, G_8, B_8);
- else
- {
- line_length = window.Font_Char("RIGHT PLAYER LASTED ", -280.0f, 55.0f, 15.0f, R_5, G_5, B_5);
- line_length = window.Font_Int((int)(paddle_object[Right].time_lapse), line_length, 55.0f, 15.0f, R_5, G_5, B_5);
- window.Font_Char(" SECONDS", line_length, 55.0f, 15.0f, R_5, G_5, B_5);
- }
- }
- else
- window.Font_Char("NO RIGHT PLAYER", -280.0f, 55.0f, 15.0f, R_5, G_5, B_5);
-
- if (paddle_object[Down].input.user != No_User)
- {
- if (paddle_object[Down].score > 0.0f)
- line_length = window.Font_Char("BOTTOM PLAYER WINS", -280.0f, 30.0f, 15.0f, R_8, G_8, B_8);
- else
- {
- line_length = window.Font_Char("BOTTOM PLAYER LASTED ", -280.0f, 30.0f, 15.0f, R_5, G_5, B_5);
- line_length = window.Font_Int((int)(paddle_object[Down].time_lapse), line_length, 30.0f, 15.0f, R_5, G_5, B_5);
- window.Font_Char(" SECONDS", line_length, 30.0f, 15.0f, R_5, G_5, B_5);
- }
- }
- else
- window.Font_Char("NO BOTTOM PLAYER", -280.0f, 30.0f, 15.0f, R_5, G_5, B_5);
-
- window.Font_Char("PRESS ENTER TO CONTINUE", -200.0f, -150.0f, 20.0f, R_4, G_4, B_4);
- }
- else if (values.game_type == High_Score)
- {
- High_Score_Struct copy_sphere;
- High_Score_Struct copy_time;
- int length = strlen(high_score_name);
- int x1;
-
- if (paddle_object[Down].time_lapse > paddle_object[Down].time_lapse_score)
- paddle_object[Down].time_lapse_score = paddle_object[Down].time_lapse;
-
- paddle_object[Compete].time_lapse_score = paddle_object[Down].time_lapse_score;
- paddle_object[Compete].score = paddle_object[Down].score;
-
- window.Font_Char("MOST SECONDS BETWEEN GOALS:", -280.0f, 130.0f, 15.0f, R_8, G_8, B_8);
- window.Font_Float(paddle_object[Compete].time_lapse_score, 2, 5.0f, 130.0f, 15.0f, R_8, G_8, B_8);
- window.Font_Char("AMOUNT OF SPHERES LET IN:", -280.0f, 105.0f, 15.0f, R_5, G_5, B_5);
- window.Font_Int((int)(paddle_object[Compete].score), 5.0f, 105.0f, 15.0f, R_5, G_5, B_5);
- window.Font_Char("PRESS ENTER TO CONTINUE", -200.0f, -150.0f, 20.0f, R_4, G_4, B_4);
-
- if (((paddle_object[Compete].score < high_score_sphere.spheres[4]) || (paddle_object[Compete].time_lapse_score > high_score_time.time[4]))
- || ((paddle_object[Compete].score == high_score_sphere.spheres[4]) && (paddle_object[Compete].time_lapse_score > high_score_sphere.time[4]))
- || ((paddle_object[Compete].time_lapse_score == high_score_time.time[4]) && (paddle_object[Compete].score < high_score_time.spheres[4])))
- {
- window.Font_Char("NAME: ", -280.0f, 30.0f, 15.0f, R_1, G_1, B_1);
- window.Font_Char(high_score_name, -225.0f, 30.0f, 15.0f, R_1, G_1, B_1);
- window.Font_Char("YOU GOT INTO THE TOP 5", -280.0f, 55.0f, 20.0f, R_1, G_1, B_1);
-
- if (window.keys[VK_BACK] == true)
- {
- high_score_name[length - 1] = NULL;
- window.keys[VK_BACK] = false;
- }
-
- if (length < 14)
- {
- for (x1='0';x1<='9';x1=x1+1)
- {
- if (window.keys[x1] == true)
- {
- high_score_name[length] = (char)(x1);
- window.keys[x1] = false;
- }
- }
-
- for (x1='A';x1<='Z';x1=x1+1)
- {
- if (window.keys[x1] == true)
- {
- high_score_name[length] = (char)(x1);
- window.keys[x1] = false;
- }
- }
- }
-
- high_score_name[15] = '\0';
- }
- else
- window.Font_Char("YOU DID NOT GET INTO THE TOP 5", -280.0f, 55.0f, 20.0f, R_1, G_1, B_1);
-
- copy_sphere = high_score_sphere;
- copy_time = high_score_time;
-
- Sort_High_Score_Sphere();
- Sort_High_Score_Time();
- Show_High_Scores(true);
-
- high_score_sphere = copy_sphere;
- high_score_time = copy_time;
-
- if (menu.Enter_Pressed() == true)
- {
- Sort_High_Score_Sphere();
- Sort_High_Score_Time();
- Save_High_Score_Verification();
- Save_Config_File();
- menu.Set_Current(&menu_main);
- }
- }
-
- if (menu.Enter_Pressed() == true)
- menu.Set_Current(&menu_main);
- }
-
- // Clear enter
- menu.Enter_Pressed();
- }
-
- /***************************************************************************/